﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Nutrition.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>


<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    MyFoodTracker
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<style type="text/css">
        .container
        {
            width:270%;
              
         }
        
        .div1
        {
            width:30%;
            height:214px;
            float:left
          }
          
        .div2
        {
            width:30%;
            height:214px;
            float:left
         }
         
         .div3
        {
            width:40%;
            height:214px;
            float:left
         }
         
       
    .style1
    {
        width: 376px;
    }
         
       
    </style>
    <%using (Html.BeginForm())
      { %>
        <%:Html.Label("MY FOOD TRACKER")%>

       <div class="container">
       <div class="div1" align="left">
           <asp:Label ID="FOODEntry" runat="server" 
               Text="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FOOD ENTRY:" BackColor="#CCCCCC" 
               Width="360px" Height="40px"></asp:Label>
               
               <%: Html.TextBox("SearchText", null, new { style = "width:120px" })%>
                        <input type="submit" value="Search"/>
                       <b>Frequently Used Foods</b>
                       
                      <%-- If there are any values to display as part of the 'SearchText' string search--%>
                        <%if (ViewData["foodDesc"] != null)
                          {%>
                          
                          <%= Html.ListBox("FoodDescription", (MultiSelectList)ViewData["foodDesc"], new { style = "width: 250px;height:221px" })%>
                          <br />
                          <br />
                          <%=Html.DropDownList("FoodTime", ViewData["list"] as SelectList)%>
                          <input type="submit" value="Select"/>
                          <%} 
                            //if there are any food items selected from the above drop down 
                            //during current session or any other previous sessions
                          if (ViewData["selectedFoodDesc"] != null && ViewData["foodDesc"] == null)
                          {
                              Hashtable foodItems = (Hashtable)ViewData["selectedFoodDesc"];
                              if (foodItems != null && foodItems.Count > 0)
                              {
                                  HashSet<KeyValuePair<string, List<string>>> breakFast = (HashSet<KeyValuePair<string, List<string>>>)foodItems["BreakFast"];%>
                              <table>
                                <tr><th>Break Fast:-</th></tr>
                              <%if (breakFast != null)
                                {
                                    foreach (KeyValuePair<string, List<string>> food in breakFast)
                                    {%>                                

                                  <tr><td><%=food.Value.First()%></td></tr>
                                      
                               
                              <%}
                                }
                                HashSet<KeyValuePair<string, List<string>>> mornSnack = (HashSet<KeyValuePair<string, List<string>>>)foodItems["Morn Snack"];%>
                               <tr><th> Morn Snack:-</th></tr>
                                <%if (mornSnack != null)
                                  {
                                      foreach (KeyValuePair<string, List<string>> food in mornSnack)
                                      {%>                                

                                  <tr><td><%=food.Value.First()%></td></tr>
                                      
                               
                              <%}
                                  }
                                  HashSet<KeyValuePair<string, List<string>>> lunch = (HashSet<KeyValuePair<string, List<string>>>)foodItems["Lunch"];%>
                                <tr><th>Lunch:-</th></tr>
                                <%if (lunch != null)
                                  {
                                      foreach (KeyValuePair<string, List<string>> food in lunch)
                                      {%>                                

                                  <tr><td><%=food.Value.First()%></td></tr>
                                      
                               
                              <%}
                                  }
                                  HashSet<KeyValuePair<string, List<string>>> afterSnack = (HashSet<KeyValuePair<string, List<string>>>)foodItems["After Snack"];%>
                                <tr><th>After Snack:-</th></tr>
                                <%if (afterSnack != null)
                                  {
                                      foreach (KeyValuePair<string, List<string>> food in afterSnack)
                                      {%>                                

                                  <tr><td><%=food.Value.First()%></td></tr>
                                      
                               
                              <%}
                                  }
                                  HashSet<KeyValuePair<string, List<string>>> dinner = (HashSet<KeyValuePair<string, List<string>>>)foodItems["Dinner"];%>
                                <tr><th>Dinner:-</th></tr>
                                <%if (dinner != null)
                                  {
                                      foreach (KeyValuePair<string, List<string>> food in dinner)
                                      {%>                                

                                  <tr><td><%=food.Value.First()%></td></tr>
                                      
                               
                              <%}
                                  }
                                  HashSet<KeyValuePair<string, List<string>>> evenSnack = (HashSet<KeyValuePair<string, List<string>>>)foodItems["Even Snack"];%>
                                <tr><th>Even Snack:-</th></tr>
                                <%if (evenSnack != null)
                                  {
                                      foreach (KeyValuePair<string, List<string>> food in evenSnack)
                                      {%>                                

                                  <tr><td><%=food.Value.First()%></td></tr>
                                      
                               
                              <%}
                                  }%></table>
                          <%}
                          }
                          //If there are no food items to display for the User.
                          else if (ViewData["foodDesc"] == null)
                          {%>
                          <table>
                           <tr><th>Break Fast:-</th></tr>
                            <tr><th>Morn Snack:-</th></tr>
                           <tr><th>Lunch:-</th></tr>
                           <tr><th>After Snack:-</th></tr>
                           <tr><th>Dinner:-</th></tr>
                           <tr><th>Even Snack:-</th></tr>
                           </table>
                           <%} %>    
                          
       </div>
       <div class="div3" align="center">
       <asp:Label ID="Label2" runat="server" Text="FOOD QUANTITY:" BackColor="#CCCCCC" 
               Width="360px" Height="40px"></asp:Label>
             
             <form id="FoodQuantity" runat="server" method="post">
               <table width="95%" >
               
               <tr>
               <th align="center">
               
               FOOD
               </th>
               <th>
               QUANTITY
               </th>
               </tr>
               <%--If there are any food items to display for 'Food Quantity' section--%>
               <%if (ViewData["selectedFoodDesc"] != null)
                 {
                     Hashtable allFoodItems = (Hashtable)ViewData["selectedFoodDesc"];
                     

                     if (allFoodItems != null && allFoodItems.Count > 0)
                     {
                         HashSet<KeyValuePair<string, List<string>>> breakFast1 = (HashSet<KeyValuePair<string, List<string>>>)allFoodItems["BreakFast"];
                         if (breakFast1 != null)
                         {
                             foreach (KeyValuePair<string, List<string>> food in breakFast1)
                             {%>

                                    <tr><td><%=food.Value.First()%></td>
                             <td><%: Html.TextBox(food.Key, food.Value.Last(), new { style = "width:60px" })%></td>
                             </tr>
                             <%}
                         }
                         HashSet<KeyValuePair<string, List<string>>> MornSnack = (HashSet<KeyValuePair<string, List<string>>>)allFoodItems["Morn Snack"];
                         if (MornSnack != null)
                         {
                             foreach (KeyValuePair<string, List<string>> food in MornSnack)
                             {%>

                                    <tr><td><%=food.Value.First()%></td>
                             <td><%: Html.TextBox(food.Key, food.Value.Last(), new { style = "width:60px" })%></td>
                             </tr>
                             <%}
                         }
                         HashSet<KeyValuePair<string, List<string>>> Lunch = (HashSet<KeyValuePair<string, List<string>>>)allFoodItems["Lunch"];
                         if (Lunch != null)
                         {
                             foreach (KeyValuePair<string, List<string>> food in Lunch)
                             {%>

                                    <tr><td><%=food.Value.First()%></td>
                             <td><%: Html.TextBox(food.Key, food.Value.Last(), new { style = "width:60px" })%></td>
                             </tr>
                             <%}
                         }
                         HashSet<KeyValuePair<string, List<string>>> AfterSnack = (HashSet<KeyValuePair<string, List<string>>>)allFoodItems["After Snack"];
                         if (AfterSnack != null)
                         {
                             foreach (KeyValuePair<string, List<string>> food in AfterSnack)
                             {%>

                                    <tr><td><%=food.Value.First()%></td>
                             <td><%: Html.TextBox(food.Key, food.Value.Last(), new { style = "width:60px" })%></td>
                             </tr>
                             <%}
                         }
                         HashSet<KeyValuePair<string, List<string>>> Dinner = (HashSet<KeyValuePair<string, List<string>>>)allFoodItems["Dinner"];
                         if (Dinner != null)
                         {
                             foreach (KeyValuePair<string, List<string>> food in Dinner)
                             {%>

                                    <tr><td><%=food.Value.First()%></td>
                             <td><%: Html.TextBox(food.Key, food.Value.Last(), new { style = "width:60px" })%></td>
                             </tr>
                             <%}
                         }
                         HashSet<KeyValuePair<string, List<string>>> EvenSnack = (HashSet<KeyValuePair<string, List<string>>>)allFoodItems["Even Snack"];
                         if (EvenSnack != null)
                         {
                             foreach (KeyValuePair<string, List<string>> food in EvenSnack)
                             {%>

                                    <tr><td><%=food.Value.First()%></td>
                             <td><%: Html.TextBox(food.Key, food.Value.Last(), new { style = "width:60px" })%></td>
                             </tr>
                             <%}
                         }

                     }
                 }%>
                </table>
                <br />
                <asp:Button ID="MyFitness" runat="server" Text="Link To My Fitness"/>
                <input type="submit" name="Analyze" value="Analyze"/>
                
                      
               
       </div>
       <div class="div2" align="center">
       <asp:Label ID="Label1" runat="server" Text="EDIT MY PROFILE:" BackColor="#CCCCCC" 
               Width="270px" Height="40px"></asp:Label>
          
            <table width="100%">
               <tr>
               <th>
               AGE(years):
               </th>
               <td width="20%">
               <%String yrs=ViewData["AGE"].ToString(); %>
                   <%: Html.Label(yrs+"yrs")%>
               </td>
               </tr>
               <tr>
               <th>
               HEIGHT(in.):
               </th><td><%: Html.TextBox("HEIGHT", null, new { style = "width:80px" })%></td>
               </tr>
               <tr>
              <th>
               WEIGHT(lbs):
               </th><td><%: Html.TextBox("WEIGHT", null, new { style = "width:80px" })%></td>
               </tr>
               <tr>
               <th>
               DATE OF ENTRY:
               </th><td><%: Html.Label(DateTime.Now.ToShortDateString())%></td>
                        
               </tr>
               <tr>
               <th>
               PHYSICAL ACTIVITY:
               </th><td><%=Html.DropDownList("ACTIVITY", ViewData["ActivityList"] as SelectList, new { style = "font-family:Trebuchet MS" })%></td>
               </tr>
               </table>   
               
          <input type="submit" name="EditProfile" value="Update"/><br />
          <asp:Button ID="Button1" runat="server" Text="Link To My Fitness" />
            </form>
       </div>
       </div>
       <%} %>
 
</asp:Content>
